/*
 * Google +1 Button jQuery Plugin
 * Copyright 2013, Jaspreet Chahal
 * Free to use under the MIT license
 * http://www.opensource.org/licenses/mit-license.php
 */
jQuery.fn.jcPlusBtn = function( settings ) {
    settings = jQuery.extend( {
        href: window.location,
        size: "standard", // small | medium | tall | standard
        annotation: "inline", // inline | bubble | none
        callback: function(){},
        async:true,
        html5:true,
        width:300 //  if not HTML5 then specify width
    }, settings )
    var jcPlusOneButtn = '';
    if(settings.html5) {
        jcPlusOneButtn =  '<div class="g-plusone" data-size="'+settings.size+'" data-annotation="'+settings.annotation+'"  data-callback="'+settings.callback+'" data-href="'+settings.href+'"></div>';;
    }
    else {
        jcPlusOneButtn = '<g:plusone size="'+settings.size+'" annotation="'+settings.annotation+'" width="'+settings.width+'" callback="'+settings.callback+'" href="'+settings.href+'"></g:plusone>';
    }
    // Render +1 Button on target DOM element(s)
    return this.each(function() {

        jQuery(this).html( jcPlusOneButtn );

        var standardGooglePlusScript = document.createElement("script");
        standardGooglePlusScript.type = "text/javascript";
        standardGooglePlusScript.async = settings.async;
        standardGooglePlusScript.id = "_googleplusbtn_jcgp";
        standardGooglePlusScript.src = "https://apis.google.com/js/plusone.js";
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(standardGooglePlusScript, s);

    })
};